#include "Dog.h"



Dog::Dog()
{
	cout << "无参构造函数" << endl;
}

Dog::Dog(string name)
{
	cout << "有参构造函数" << endl;
	this->name = name;
}

//默认的拷贝构造函数是浅拷贝,如果成员变量只是普通类型,没什么问题,如果成员变量有指针,那么浅拷贝也只是把指针拷贝了一次,二而指针指向的内存并没有拷贝
Dog::Dog(const Dog & dog)
{
	this->name = dog.get_name();
	cout << "拷贝构造函数" << endl;
}


Dog::~Dog()
{
	cout << "析构函数" << endl;
}

void Dog::set_name(string name)
{
	this->name = name;
}

string Dog::get_name()const
{
	return this->name;
}
